package com.tibco.gwt.core.client.ui;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.event.logical.shared.AttachEvent;
import com.google.gwt.user.client.ui.HTMLPanel;

public class ListContainer extends Composite {

	private static ListContainerUiBinder uiBinder = GWT
			.create(ListContainerUiBinder.class);
	@UiField HTMLPanel listcontainerPanel;

	interface ListContainerUiBinder extends UiBinder<Widget, ListContainer> {
	}

	public ListContainer() {
		initWidget(uiBinder.createAndBindUi(this));
	}
	@UiHandler("listcontainerPanel")
	void onListcontainerPanelAttachOrDetach(AttachEvent event) {
		/*
		 * Grid g = new Grid(5, 5); // Put some values in the grid cells. for
		 * (int row = 0; row < 5; ++row) { for (int col = 0; col < 5; ++col)
		 * g.setText(row, col, "" + row + ", " + col); }
		 */
	    Grid grid = new Grid(4, 4);
	    grid.setBorderWidth(1);
	    int numRows = grid.getRowCount();
	    int numColumns = grid.getColumnCount();
	    for (int row = 0; row < numRows; row++) {
	      for (int col = 0; col < numColumns; col++) {
	        grid.setWidget(row, col, new Image("gwtuxcore/gwt/standard/images/fish-96x96.gif"));
	    	  //grid.setText(row, col, "" + row + ", " + col);
	      }
	    }
	    grid.setSize("300px", "300px");
	    ScrollPanel sp=new ScrollPanel();
	    sp.add(grid);
	    listcontainerPanel.add(sp);
	    listcontainerPanel.setSize("200px", "200px");
	    //listcontainerPanel.add(grid);
	    //listcontainerPanel.setWidth("100");
	    //listcontainerPanel.setHeight("100");
	}
}
